package com.atguigu.jxc.controller;

import com.atguigu.jxc.entity.Log;
import com.atguigu.jxc.service.GoodsService;
import com.atguigu.jxc.service.LogService;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author dyqstart
 * @create 2021-09-04-10:24
 * @since 1.0.0
 */
@RestController
@RequestMapping("/unit")
public class GoodsUnitController {

    @Autowired
    GoodsService goodsService;

    @Autowired
    LogService logService;

    @PostMapping("/list")
    public Map<String,Object> getUnitList(){
        Map<String,Object> map = goodsService.getUnit();
        Log log = new Log(Log.SELECT_ACTION,"查询商品单位");
        logService.save(log);
        return map;
    }
}
